<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="./css/index.css">
    <link rel="icon" href="assets/images/facicon.ico" type="image/x-icon" />
</head>
<style>
    #header {
        height: 50px;
        background-color: red;
        padding: 5px;
        text-align: center;
        position: relative;
    }

    #header .back {
        font-size: 20px;
        color: #ffffff;
        position: absolute;
        left: .2667rem;
        top: 20%;
    }

    #header .back img {
        width: 1.0667rem;
        background-color: #ffffff;
    }

    #header>h4 {
        display: inline-block;
        text-align: center;
        font-size: 20px;
        color: #ffffff;
        padding-left: 30px;
        margin: .6667rem 0;
    }

    #header .back {
        display: block;
    }

    #header .app {
        position: absolute;
        right: .2667rem;
        top: 20%;
        padding: 7px;
    }

    #header .app img {
        width: .9333rem;
    }

    #product {
        width: 6.9333rem;
        height: 4.8rem;
        display: flex;
        justify-content: space-around;
        flex-wrap: wrap;
        margin-left: 15%;
        margin-top: 1.3867rem;
    }

    #product>div {
        border: .0533rem solid #ccc;
        width: 3.2rem;
        height: 2.1333rem;
        position: relative;
        bottom: .5333rem;
        text-align: center;
        font: .64rem/.96rem "";
        color: #000;
    }
</style>
</head>

<body>
    <header id="header">
        <a href="./index.html" class="back fl"><img src="./assets/images/back.png" alt=""></a>
        <h4>优惠券</h4>
        <div class="app fr">
            <a href="">
                <img src="./assets/images/app.png" alt="">
            </a>
        </div>
    </header>

    <div id="product">

    </div>

    <section id="footer">
        <div class="more">
            <a href="">
                更多优惠信息&gt;&gt;
            </a>
        </div>
        <div class="chart clearfix">
            <span class="chart_in fl">品牌排行</span>
            <span class="more fr">
                <img src="./assets/images/youjian.png" alt="">
            </span>
        </div>
        <div class="login">
            <div class="container">
                <div class="row">
                    <a href="">
                        <div class="col-xs-3">登入</div>
                    </a>
                    <a href="">
                        <div class="col-xs-4">注册</div>
                    </a>
                    <a href="">
                        <div class="col-xs-5">返回顶部</div>
                    </a>
                    <span></span>
                </div>
            </div>
            <div class="content_b">
                <p>
                    <a href="#">
                        手机APP下载
                    </a>
                    <a href="#">
                        万锋智慧商城手机版
                    </a>
                    -- 掌上比价平台
                </p>
                <p>
                    chst.vip:8081/crm </p>
            </div>
        </div>
    </section>
</body>

</html>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="./utils/flexible.js"></script>
<script>
    let product = document.querySelector('#product')
    fetch('http://chst.vip:1234/api/getcoupon')
        .then(body => body.json())
        .then(res => {
            console.log(res)
            let el2 = ""
            res.result.forEach(item => {
                el2 += `<div id="${item.couponId}">
                    ${item.couponTitle}
                </div>`

            })
            product.innerHTML = el2;
            fn2()
        })


    function fn2() {
        $("#product>div").click(function () {
            console.log(this.id)
            let id = this.id
            location.href = "./kfcdetail.html?id=" + id
        })
        $("#header>.img1").click(function () {
            location.href = "./index.html"
        })
    }



</script>